package com.eastfair.home.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 搭建商报修申请
 * </p>
 *
 * @author dqq
 * @date 2022-12-13
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "BuilderRepairReportRepairStatusEnum", description = "报修状态 #{HAS_REPORT:已申请;HAS_CHECK:已检测;HAS_REPORT_VENUE:已报馆;COMPLETE:已完成;CANCEL:已取消-枚举")
public enum BuilderRepairReportRepairStatusEnum implements BaseEnum {

    /**
     * HAS_REPORT="已申请"
     */
    HAS_REPORT("已申请"),
    /**
     * HAS_CHECK="已检测"
     */
    HAS_CHECK("已检测"),
    /**
     * HAS_REPORT_VENUE="已报馆"
     */
    HAS_REPORT_VENUE("已报馆"),
    /**
     * COMPLETE="已完成"
     */
    COMPLETE("已完成"),
    /**
     * CANCEL="已取消"
     */
    CANCEL("已取消"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static BuilderRepairReportRepairStatusEnum match(String val, BuilderRepairReportRepairStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static BuilderRepairReportRepairStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(BuilderRepairReportRepairStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "HAS_REPORT,HAS_CHECK,HAS_REPORT_VENUE,COMPLETE,CANCEL", example = "HAS_REPORT")
    public String getCode() {
        return this.name();
    }

}
